
<%@page import="com.bill.common.user.dto.RegUserBasicDTO"%>
<%@page import="com.bill.common.user.service.IRegisterUserService"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>

<%
if(session.getAttribute("password2")==null){
	response.sendRedirect( "login2.jsp?pageUrl=user/pi.jsp");
	return;
}

ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
IRegisterUserService registerUserService = (IRegisterUserService)ac.getBean("registerUserService");
RegUserBasicDTO rubDTO = registerUserService.findRegUserBasicInfo((String)session.getAttribute("loginName"));
request.setAttribute("rubDTO",rubDTO);

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title><fmt:message key="i18n.title"/> </title>
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	
	<link rel="shortcut icon" href="../index/favicon.png" />
	
	<!-- bootstrap -->
    <link href="css/bootstrap/bootstrap.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />

    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="css/elements.css" />
    <link rel="stylesheet" type="text/css" href="css/icons.css" />
    
    <!-- this page specific styles -->
    <link rel="stylesheet" href="css/compiled/new-user.css" type="text/css" media="screen" />
    
</head>
<body>

	<!-- main container -->
	<div class="content container-fluid">
		<!-- BreadcrumbNavigation -->
        <div class="row-fluid head">
            <div class="span12">
                <h4><fmt:message key="i18n.userCenter"/> &gt; <fmt:message key="i18n.updateUserInfo"/></h4>
            </div>
        </div>
        <!-- End BreadcrumbNavigation -->
        
        <div class="container-fluid">
            <div id="pad-wrapper" class="new-user">

                <div class="row-fluid form-wrapper">
                    <!-- left column -->
                    <div class="span9 with-sidebar">
                        <div class="container">
                        	<br>
                            <form class="new_user_form inline-input" id="updateInfo_form" action="registerUser!changeRegUserBasicInfo.action" method="post" onsubmit="return changeBasicInfo();">
						    	<input type="hidden" name="rubDTO.loginName" value="${rubDTO.loginName }" />
						       	<input type="hidden" type="hidden" name="rubDTO.registerUserId" value="${rubDTO.registerUserId }" />
						       	<input type="hidden" name="rubDTO.qq" value="${rubDTO.qq }" />
						       	<input type="hidden" name="rubDTO.email" value="${rubDTO.email }" />
						       	<!-- <input type="hidden" id="pi_loginUser_authCodeType" name="rubDTO.authCodeType"/> -->
						       	<input type="hidden"  name="pageUrl" value="pi.jsp" />
                                <div class="span12 field-box">
                                    <label><fmt:message key="i18n.piUserName"/>:</label>
                                    <input type="text" class="span9" name="rubDTO.userName" id="pi_userName"  value="${rubDTO.userName }" />
                                </div>
                                <div class="span12 field-box">
                                    <label><fmt:message key="i18n.openUserBank"/>:</label>
                                    <div class="ui-select span5">
                                        <select class="tx_contBoxR2_1" id="accountType" name="rubDTO.accountType" >
											<option value="中国农业银行" <c:if test="${rubDTO.accountType eq '中国农业银行' }">selected</c:if>><fmt:message key="i18n.abcBank"/></option>
											<option value="中国工商银行" <c:if test="${rubDTO.accountType eq '中国工商银行' }">selected</c:if>><fmt:message key="i18n.gongBank"/></option>
											<option value="中国建设银行" <c:if test="${rubDTO.accountType eq '中国建设银行' }">selected</c:if>><fmt:message key="i18n.ccbBank"/></option>
											
											<option value="中国交通银行" <c:if test="${rubDTO.accountType eq '中国交通银行' }">selected</c:if>><fmt:message key="i18n.jiaoBank"/></option>
											<option value="中国浦发银行" <c:if test="${rubDTO.accountType eq '中国浦发银行' }">selected</c:if>><fmt:message key="i18n.pufaBank"/></option>
											<option value="中国银行" <c:if test="${rubDTO.accountType eq '中国银行' }">selected</c:if>><fmt:message key="i18n.chinaBank"/></option>
											<option value="中国邮政" <c:if test="${rubDTO.accountType eq '中国邮政' }">selected</c:if>><fmt:message key="i18n.emsBank"/></option>
											
											<option value="中信银行" <c:if test="${rubDTO.accountType eq '中信银行' }">selected</c:if>><fmt:message key="i18n.zhongxinBank"/></option>
											<option value="招商银行" <c:if test="${rubDTO.accountType eq '招商银行' }">selected</c:if>><fmt:message key="i18n.cmbchina"/></option>
											<option value="光大银行" <c:if test="${rubDTO.accountType eq '光大银行' }">selected</c:if>><fmt:message key="i18n.cebbank"/></option>
											<option value="平安银行" <c:if test="${rubDTO.accountType eq '平安银行' }">selected</c:if>><fmt:message key="i18n.pingan"/></option>
											<option value="华夏银行" <c:if test="${rubDTO.accountType eq '华夏银行' }">selected</c:if>><fmt:message key="i18n.hxb"/></option>
											
											<option value="财付通" <c:if test="${rubDTO.accountType eq '财付通' }">selected</c:if>><fmt:message key="i18n.caifutong"/></option>
											<option value="支付宝" <c:if test="${rubDTO.accountType eq '支付宝' }">selected</c:if>>支付宝</option>
										</select>
                                    </div>
                                </div>
                                <div class="span12 field-box">
                                    <label><fmt:message key="i18n.piBrankAccount"/>:</label>
                                    <input type="text" class="span9" name="rubDTO.bankAccount" required="true" value="${rubDTO.bankAccount }">
                                </div>
                                <div class="span12 field-box">
                                    <label><fmt:message key="i18n.openBankAddress"/>:</label>
                                    <input type="text" class="span9" name="rubDTO.openBankAddress" required="true" value="${rubDTO.openBankAddress }" />
                                </div>
                                <div class="span12 field-box">
                                    <label>手机号码:</label>
                                    <input type="hidden" id="cp_loginUserMobile" name="rubDTO.mobile" value="${rubDTO.mobile}" />
									<input type="text" class="span9" name="rubDTO.newMobile" readonly="readonly" id="cp_loginUserMobile_new" value="${rubDTO.mobile}" />
                                </div>
                                <div class="span12 field-box">
                                    <label>手机验证码:</label>
                                    <input type="text" class="span9" id="cp_validCode" name="rubDTO.authCode"  style="margin-right: 6px;width: 100px;" >
									<input type="button" class="ctrR1Box4" id="cp_loginName_button" 
										value="<fmt:message key="i18n.getVerificationCode"/>" 
										style="margin: 13px 0 0 0;height: 28px;line-height: 28px;" /> 
									<input type="hidden" value="${session.email }" id="cp_loginName"/>
                                </div>
                                <div class="span11 field-box">
                                	<c:if test="${not empty session.activationTime}">
									<input type="submit" class=btn-glow primary value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<fmt:message key="i18n.update"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" />
									</c:if>
									<c:if test="${empty session.activationTime}">
										<fmt:message key="tip.activeTip" />
									</c:if>
                                </div>
                            </form>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        
    </div>    

	<script type="text/javascript" src="../scripts/jquery-1.11.0.min.js"></script>
	<script type="text/javascript" src="../scripts/user/common.js"></script>
	<script type="text/javascript">
	
	function changeBasicInfo(){
		if($('#pi_userName').val()==''){
			alert('The name cannot be empty(姓名不能为空)!');
			$('#pi_userName').focus();
			return false;
		}
		
		if($('#pi_email').val()==''){
			alert('Email address can not be empty(邮件地址不能为空)!');
			$('#pi_email').focus();
			return false;
		}
		
		if($('#pi_passwordAnswer').val()==''){
			alert('Secret security answer allowed is empty(密保答案不允许为空)!');
			$('#pi_passwordAnswer').focus();
			return false;
		}
		
		if($('#cp_validCode').val()==''){
			alert('Verification code cannot be empty(验证码不能为空)!');
			$('#cp_validCode').focus();
			return false;
		}
	/* 	
		$.post('activationCode!authEmailCode.action','dto.type=邮件&dto.category=UpdateUser&dto.activationCode='+$('#pi_validCode').val(),function(res){
			 if(!res){
				 alert('E-mail verification code is not correct(邮箱验证码不正确)!');
				 return false;
			 }else{
				 $('#updateInfo_form').submit();
			 }
		}); */
	}
	
	$(function(){
		document.onkeydown = function(evt){
			var evt = window.event?window.event:evt;
			if(evt.keyCode==13){
				changeBasicInfo();
			}
		}
		$("#cp_loginName_button").click(function(){
			if($("#cp_loginUserMobile").val() && $("#cp_loginUserMobile").val().length > 0){
				getVerificationCode('Mobile','ChangeInfo','#cp_loginUserMobile','#cp_loginName_button');
			}else if($("#cp_loginName").val() && $("#cp_loginName").val().length > 0){
				getVerificationCode('Email','ChangeInfo','#cp_loginName','#cp_loginName_button');
			}else{
				alert('未找到有效邮箱或者手机号码，无法进行验证!');
			}
		});
	});
	</script>

				
</body>
</html>